var fruits = [

    {

        fruitName: '苹果',

        fruitQuantity: 30,

        fruitPrice: 3.8

    },

    {

        fruitName: '西瓜',

        fruitQuantity: 240,

        fruitPrice: 1.8

    },

    {

        fruitName: '芒果',

        fruitQuantity: 60,

        fruitPrice: 7.8

    }

]
let total = 0;
for (let i = 0; i < fruits.length; i++) {
    console.log(fruits[i].fruitName);
}

for (let i in fruits) {
    console.log(fruits[i].fruitName, fruits[i].fruitPrice);
}

for (let i of fruits) {
    console.log(i.fruitQuantity * i.fruitPrice);
}

fruits.forEach(item => {
    total = total + item.fruitQuantity
})
console.log(total);

fruits=fruits.map(item=>item.fruitQuantity+5)
console.log(fruits);